// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {

    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
       //右向左 上 小 0.8  0.8  558
       //左向右 下 大 -1   1   526
        if(Math.random() < 0.5){
            this.node.setPosition(700,558);
            this.node.scaleX = 0.8;
            this.node.scaleY = 0.8;
            this.node.runAction(cc.sequence(cc.moveTo(3,-700,558),cc.callFunc(function(){
                this.node.destroy();
            },this)));
        }else{
            this.node.setPosition(-700,526);
            this.node.scaleX = -1;
            this.node.scaleY = 1;
            this.node.runAction(cc.sequence(cc.moveTo(3,700,526),cc.callFunc(function(){
                this.node.destroy();
            },this)));
        }

    },

    // update (dt) {},
});
